<template>
	<view>
		<tn-nav-bar :isBack='true' :backTitle='" "' bottomShadow fixed alpha customBack>
			<view slot="back" class='customBack'>
				<!-- <image src="/static/product/back.png" class="back" mode=""></image> -->
			</view>
			<!-- <view slot="right" @click="to('/pages/my/set')">
				<image src="/static/personal/set.png" class="set" mode=""></image>
			</view> -->
			<view class="" style="color: #fff;">

			</view>
		</tn-nav-bar>
		<image src="/static/product/topbg.png" class="topbg" mode=""></image>
		<view :style="{paddingTop: vuex_custom_bar_height + 'px'}" class="con">
			<view class="user">
				<tn-avatar :src="URL(userinfo.avatar)" size='144rpx'></tn-avatar>
				<view class="user__center">
					<view class="user__name" @click="login">
						{{userinfo.username?userinfo.username:'请登录'}}
					</view>
					<view class="tn-flex tn-flex-col-bottom">
						<view class="user__id">
							ID:{{userinfo.id||''}}
						</view>
						<image v-if="userinfo.level" :src="URL(userinfo.level.image)" class="lv" mode="heightFix"></image>
					</view>
				</view>
			</view>
			<view class="num">
				<view class="num__item" @click="to('/pages/achievement/wallet')">
					<view class="num__item__value">
						{{userinfo.money||0}}
					</view>
					<view class="num__item__text">
						我的余额
					</view>
				</view>
				<view class="num__item" @click="to('/pages/my/collection')">
					<view class="num__item__value">
						{{userinfo.myCollect||0}}
					</view>
					<view class="num__item__text">
						我的收藏
					</view>
				</view>
				<view class="num__item" @click="to('/pages/achievement/myachievement')">
					<view class="num__item__value">
						{{userinfo.myPerformance||0}}
					</view>
					<view class="num__item__text">
						个人业绩
					</view>
				</view>
				<view class="num__item" @click="to('/pages/achievement/myachievement')">
					<view class="num__item__value">
						{{userinfo.teamPerformance||0}}
					</view>
					<view class="num__item__text">
						团队业绩
					</view>
				</view>
			</view>
			<view class="box">
				<view class="box__top">
					<image src="/static/personal/td.png" class="box__top__bg" mode=""></image>
					<view class="box__top__con">
						<view class="tn-flex tn-flex-col-center">
							<image src="/static/personal/vip.png" class="box__top__vip" mode=""></image>
							邀请我的好友
						</view>
						<tn-button fontColor="#805101" shape='round' width='180rpx' height='60rpx' :fontSize='26'
							backgroundColor="#FCE3B7" @click="to('/pages/my/team')">我的团队</tn-button>
					</view>
				</view>
				<view class="box__bottom">
					<view class="box__bottom__item">
						<image src="/static/personal/jlzx.png" class="box__bottom__item__jl" mode=""></image>
						<view class="box__bottom__item__box" @click="to('/pages/my/profit')">
							<image src="/static/personal/sybg.png" class="box__bottom__item__box__bg" mode=""></image>
							<view class="box__bottom__item__box__title">
								我的收益
								<view class="box__bottom__item__box__title__sy">
									今日收益+{{userinfo.todayMoney||0}}
								</view>
							</view>
							<view class="box__bottom__item__box__num">
								{{userinfo.totalMoney||0}}
							</view>
							<image src="/static/personal/sy.png" class="box__bottom__item__box__jb" mode=""></image>
						</view>
					</view>
					<view class="box__bottom__line">

					</view>
					<view class="box__bottom__item">
						<image src="/static/personal/yqhy.png" class="box__bottom__item__yq" mode=""></image>
						<view class="box__bottom__item__box">
							<image src="/static/personal/sqbg.png" class="box__bottom__item__box__bg" mode=""></image>
							<view class="box__bottom__item__box__title">
								自用省钱
							</view>
							<view class="box__bottom__item__box__fxzq">
								分享赚钱
							</view>
							<view class="box__bottom__item__box__btn" hover-class="tn-hover"
								@click="to('/pages/profit/invite')">
								邀请好友
								<!-- <tn-button fontColor="#FDFAFB" shape='round' width='120rpx' height='43rpx' :fontSize='20' backgroundColor="tn-bg-red" shadow>邀请好友</tn-button> -->
							</view>
							<image src="/static/personal/zq.png" class="box__bottom__item__box__zq" mode=""></image>

						</view>

					</view>
				</view>
			</view>
			<view class="box1">
				<view class="box1__title">
					常用功能
				</view>
				<view class="tn-flex tn-flex-col-center tn-flex-wrap">
					<view class="box1__item" v-for="(item,index) in list" :key="index" @click="to(item.url)"
						hover-class="tn-hover">
						<image :src="'/static/personal/'+item.icon+'.png'" class="box1__item__icon" mode=""></image>
						<view class="box1__item__text">
							{{item.name}}
						</view>
					</view>
					<button class="box1__item u-reset-button" open-type="contact" style="margin: 0;">
						<image src="/static/personal/kf1.png" class="box1__item__icon" mode=""></image>
						<view class="box1__item__text">
							联系客服
						</view>
					</button>
					<view class="box1__item" hover-class="tn-hover" @click="to('/pages/my/set')">
						<image src="/static/personal/sz.png" class="box1__item__icon" mode=""></image>
						<view class="box1__item__text">
							设置
						</view>
					</view>
				</view>

			</view>

		</view>
	</view>
</template>

<script>
	
	export default {
		props: {
			alpha: {
				default: true,
				type: Boolean
			},
			userinfo:{
				default: {},
				type: Object
			}
		},
		name: 'personal',
		computed: {
			// 兼容小程序
			gridItemWidth() {
				return 100 / this.col + '%'
			}
		},
		data() {
			return {

				list: [{
						name: '产品管理',
						icon: 'gl',
						url: '/pages/product/manage'
					},
					{
						name: '我的钱包',
						icon: 'qb',
						url: '/pages/achievement/wallet'
					},
					{
						name: '出行订单',
						icon: 'dd',
						url: '/pages/my/order'
					},
					{
						name: '个人资料',
						icon: 'zl',
						url: '/pages/profit/info'
					},
					// {
					// 	name: '联系客服',
					// 	icon: 'kf1',
					// 	url: ''
					// },
					// {
					// 	name: '设置',
					// 	icon: 'sz',
						
					// 	url: '/pages/my/set'
					// },
				],
			};
		},
		methods: {
			clicktab(e) {
				console.log(e)
			},
			login(){
				if(!this.userinfo.username){
					this.to('/pages/my/login')
				}
			}
		},
		created() {
			// 判断是否有userinfo16fa3a2b-ce5a-4b97-ab1e-6e565f348331
			
		}
	}
</script>

<style lang="scss">
	.set {
		width: 41rpx;
		height: 45rpx;
	}

	.back {
		width: 19rpx;
		height: 32rpx;
		margin-left: 10rpx;
	}

	.customBack {
		height: 100%;
		display: flex;
		align-items: center;
	}

	.con {

		padding: 30rpx;
		position: relative;

		.user {
			display: flex;
			align-items: center;
			padding-top: 40rpx;

			&__center {
				display: flex;
				flex-direction: column;
				justify-content: center;
				margin-left: 32rpx;

			}

			&__name {
				font-family: PingFang SC;
				font-weight: 800;
				font-size: 38rpx;
				color: #000001;
				line-height: 38rpx;
				margin-bottom: 15rpx;
			}

			&__id {
				background: #E6F5EF;
				border-radius: 22rpx;
				padding: 14rpx 16rpx;
				font-family: PingFang SC;
				font-weight: 400;
				font-size: 22rpx;
				color: rgba(4, 140, 62, .8);
				line-height: 22rpx;

			}

			.lv {
				// width: 159rpx;
				height: 51rpx;
				margin-left: 22rpx;
			}
		}

		.num {
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin-top: 50rpx;

			&__item {
				display: flex;
				flex-direction: column;
				align-items: center;
				width: 25%;

				&__value {
					font-family: DINNextLTPro-Bold;
					font-weight: bold;
					font-size: 40rpx;
					color: #000000;
					line-height: 29rpx;
				}

				&__text {
					font-family: PingFang SC;
					font-weight: bold;
					font-size: 24rpx;
					color: #95979B;
					line-height: 24rpx;
					margin-top: 14rpx;
				}
			}
		}

		.box {
			background: #FFFFFF;
			border-radius: 20rpx;
			overflow: hidden;
			margin-top: 34rpx;

			&__top {
				width: 690rpx;
				height: 133rpx;
				position: relative;

				&__bg {
					width: 690rpx;
					height: 133rpx;
					position: absolute;
					top: 0;
					left: 0;

				}

				&__con {
					display: flex;
					align-items: center;
					justify-content: space-between;
					padding: 26rpx 32rpx;
					font-family: PingFang SC;
					font-weight: bold;
					font-size: 26rpx;
					color: #E0C79C;
					line-height: 26rpx;
					position: relative;
				}

				&__vip {
					width: 50rpx;
					height: 37rpx;
					margin-right: 17rpx;
				}
			}

			&__bottom {
				padding: 14rpx 20rpx 28rpx;
				display: flex;
				align-items: center;
				justify-content: center;

				&__line {
					width: 0;
					height: 237rpx;
					border-right: 2rpx dashed #F4F4F4;
					margin: 0 19rpx;
				}

				&__item {
					display: flex;
					flex-direction: column;
					align-items: flex-start;

					&__jl {
						width: 119rpx;
						height: 28rpx;
					}

					&__yq {
						width: 220rpx;
						height: 28rpx;
					}

					&__tx {
						padding: 7rpx 6rpx 4rpx 5rpx;
						background: linear-gradient(0deg, #FF6A59 0%, #FF5345 100%);
						border-radius: 14rpx 14rpx 14rpx 0rpx;
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 16rpx;
						color: #FFFFFF;
						line-height: 16rpx;
					}

					&__box {
						width: 302rpx;
						height: 169rpx;
						position: relative;
						margin-top: 34rpx;

						&__bg {
							width: 302rpx;
							height: 169rpx;
							position: absolute;
							top: 0;
							left: 0;
						}

						&__title {
							font-family: PingFang SC;
							font-weight: bold;
							font-size: 24rpx;
							color: #080904;
							line-height: 24rpx;
							display: flex;
							align-items: center;
							justify-content: space-between;
							padding: 29rpx 16rpx 0 20rpx;
							position: relative;

							&__sy {
								font-family: PingFang SC;
								font-weight: 500;
								font-size: 20rpx;
								color: #BE472D;
								line-height: 20rpx;
							}
						}

						&__num {
							position: relative;
							font-family: DINNextLTPro-Bold;
							font-weight: bold;
							font-size: 52rpx;
							color: #080904;
							line-height: 37rpx;
							margin-top: 52rpx;
							padding-left: 16rpx;
						}

						&__jb {
							width: 95rpx;
							height: 89rpx;
							position: absolute;
							bottom: 14rpx;
							right: 11rpx;
						}

						&__zq {
							position: absolute;
							width: 79rpx;
							height: 94rpx;
							bottom: 18rpx;
							right: 14rpx;
						}

						&__fxzq {
							font-family: PingFang SC;
							font-weight: 500;
							font-size: 20rpx;
							color: #BE472D;
							line-height: 20rpx;
							position: relative;
							padding-left: 20rpx;
							margin-top: 14rpx;
						}

						&__btn {
							width: fit-content;
							position: relative;
							margin-top: 18rpx;
							margin-left: 20rpx;
							padding: 0 15rpx;
							height: 43rpx;
							background: linear-gradient(90deg, #FE7700 0%, #FF1003 100%);
							border-radius: 22rpx;
							font-family: PingFang SC;
							font-weight: 500;
							font-size: 20rpx;
							color: #FDFAFB;
							line-height: 43rpx;
							text-shadow: 0rpx 0rpx 35rpx rgba(194, 86, 65, 0.07);
						}
					}


				}
			}
		}

		.box1 {
			border-radius: 20rpx;
			background-color: #fff;
			padding-bottom: 30rpx;
			margin-top: 20rpx;

			&__title {
				font-family: PingFang SC;
				font-weight: 800;
				font-size: 30rpx;
				color: #080904;
				line-height: 30rpx;
				padding: 40rpx 0 38rpx 30rpx;

			}

			&__item {
				width: 25%;
				display: flex;
				flex-direction: column;
				align-items: center;
				padding-bottom: 36rpx;

				&__icon {
					width: 59rpx;
					height: 59rpx;
					margin-bottom: 14rpx;
				}

				&__text {
					font-family: PingFang SC;
					font-weight: 500;
					font-size: 23rpx;
					color: #080904;
					line-height: 23rpx;
				}
			}
		}
	}
</style>